package com.com.effectivejava.generics.test;

import com.com.effectivejava.generics.util.Union;
import org.junit.*;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

/**
 * Created by pankaj on 7/13/14.
 */
public class UnionTester {

    static Logger logger = Logger.getLogger(UnionTester.class.getName());

    static {
        logger.setParent(Logger.getLogger(UnionTester.class.getPackage().getName()));
    }

    Union<Integer> union= new Union<>();

    List<Integer> integer1 = null;
    List<Integer> integer2 = null;
    List<Number> numbers = null;


    @BeforeClass
    public static void setUpOnce(){

    }

    @Before
    public void setUp(){
        integer1 = new ArrayList<Integer>(){{
            add(1);
            add(2);
            add(3);
            add(4);
        }};

        integer2 = new ArrayList<Integer>(){{
            add(1);
            add(5);
            add(6);
        }};
        numbers = new ArrayList<>();
    }

    @Test
    public void mustContainSevenE(){
        union.add(integer1, integer2);
        union.union(numbers);
        logger.info(numbers.size()+"");
        Assert.assertTrue(numbers.size()==6);
    }

    @After
    public void tearDown(){
        // clean up fixtures if necessary i.e non memory resources connections files
    }

    @AfterClass
    public static void tearDownOnce(){
        // clean up just once
    }
}

